UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'IcPpSxUXUv6wCNZ46vqVtgswdiNZWad8gjRbTtIg+gQ=' 
WHERE 
  key_id = 'ff7e79f3e9811c5e2b38cba9b3d978c9b7a51620603f244d9ae5e258debc076e' 
  AND (
    token = 'IcPpSxUXUv6wCNZ46vqVtgswdiNZWad8gjRbTtIg+gQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021