UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'IRoCsZuxWW7Pu39P9sDafzDe+Qe6CGGHTH7JXkaBteE=' 
WHERE 
  key_id = '9997c2a19b3bea6560e439610f9f059527654b1008665041a4b2d2a7a76b0251' 
  AND (
    token = 'IRoCsZuxWW7Pu39P9sDafzDe+Qe6CGGHTH7JXkaBteE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035