UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'pOiu4ninMxOypcumH6UCNORX86bfp8qxsLSEvaqP9PI=' 
WHERE 
  key_id = '1ad738d96e650edea00762fbc14cb02f784e73340628023d1093c4ab20b18e21' 
  AND (
    token = 'pOiu4ninMxOypcumH6UCNORX86bfp8qxsLSEvaqP9PI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032