UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'fBkMBDOMOe8QVWaFUV2hQeMeqpPJRvkC0qDyUL3+s6g=' 
WHERE 
  key_id = '1143f5fe6778db440e5ac77086a6b918dec6de73d8c2eb412c8a0a678f1d8723' 
  AND (
    token = 'fBkMBDOMOe8QVWaFUV2hQeMeqpPJRvkC0qDyUL3+s6g=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035