UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '302RS2qpwh/6E+5kqmVzZehyub5GJIG7tei4jZj3aPE=' 
WHERE 
  key_id = 'aff36870f83b8b64ae3346787e73622b327d3b135d8d15169d0d893ab4ed6f29' 
  AND (
    token = '302RS2qpwh/6E+5kqmVzZehyub5GJIG7tei4jZj3aPE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041