UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'di2YPpvUj3k5iD+d9uBOBeZwDek3FX3sFRLnnSkO5Ck=' 
WHERE 
  key_id = 'b6acad7583108013fe872afc4022639ad815cde8dab5fe43ddb69e539173e8d5' 
  AND (
    token = 'di2YPpvUj3k5iD+d9uBOBeZwDek3FX3sFRLnnSkO5Ck=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034