UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '+y98DhN6iOAM9PAJCytzqRM+kRxENwsYArgtwfUk7OU=' 
WHERE 
  key_id = 'cc7a4047d2cc24018b4b7fa315278f7c681391acefdc29e13a9e79030c4298d2' 
  AND (
    token = '+y98DhN6iOAM9PAJCytzqRM+kRxENwsYArgtwfUk7OU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036