UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ca8wR7S7eclEvAyU5oIn0Ws00imoPhAodFxjyClAQRY=' 
WHERE 
  key_id = 'ce9fc2a464202f8b3a25ff038a19e47f5e1bc177cb386b3db3c43127639bbf7f' 
  AND (
    token = 'ca8wR7S7eclEvAyU5oIn0Ws00imoPhAodFxjyClAQRY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032