UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Jx63mvO97462LUVhuYVDyEjj+dUn8HMEn5uWwrTYSKc=' 
WHERE 
  key_id = '16fcdf7fa158f94e3818feede262f63dc6dd8efc1a65501ef72a047bae5678e3' 
  AND (
    token = 'Jx63mvO97462LUVhuYVDyEjj+dUn8HMEn5uWwrTYSKc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024