UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'TcTIf+f7ffKxHpnWiog/eJut+kCzGqdCdmtHVfzWQss=' 
WHERE 
  key_id = 'c59870e657ca0a9fe30987ad5f8e358f6e548088de847896cb410d7f2ba74dea' 
  AND (
    token = 'TcTIf+f7ffKxHpnWiog/eJut+kCzGqdCdmtHVfzWQss=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00011