UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'm5qwxujugjeRAnqQSSs7+oi3e3jFR49KzOvOYnGvcUc=' 
WHERE 
  key_id = '4c0497031f1114324febca7592adaa330f0e56b97aa3e513bd18a5e65b316d8f' 
  AND (
    token = 'm5qwxujugjeRAnqQSSs7+oi3e3jFR49KzOvOYnGvcUc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041