UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'bSHc1d+oM/rlzJRLzDTGrIZwpumJe3qujWlHp6yuzK0=' 
WHERE 
  key_id = '3fe56413e5b6078479f09e3a4dfd20d88a2774e9cffb0479f53b1ede75617b49' 
  AND (
    token = 'bSHc1d+oM/rlzJRLzDTGrIZwpumJe3qujWlHp6yuzK0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023