UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ovCVEGKjQ5QKOGn4QwF9OAmkbT6qzFUpr2+dakFAYFA=' 
WHERE 
  key_id = '56524d4cdffdd49f56cfa4cf3f74c1a420c726d7f0a12a84c9becd034bfa2f1e' 
  AND (
    token = 'ovCVEGKjQ5QKOGn4QwF9OAmkbT6qzFUpr2+dakFAYFA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00052