UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'w2OLybS9gmVUwuuEDccGclt8XEGwOwGJw0jobEXhtbQ=' 
WHERE 
  key_id = '3b93d570087bc1a8020c668a99311596b0a784ea9056b04b753253bba26c90b2' 
  AND (
    token = 'w2OLybS9gmVUwuuEDccGclt8XEGwOwGJw0jobEXhtbQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00050