UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'A/l6yoVciAW0lwgnM+TmC023EZKTrnYjLmKltOFjzTw=' 
WHERE 
  key_id = '4bd728cec21cfb3c2ccc537cff6092fb9dc9caad5593552baff6c44d938e26f1' 
  AND (
    token = 'A/l6yoVciAW0lwgnM+TmC023EZKTrnYjLmKltOFjzTw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034