UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'xIkjw2Komt+ry2QGNkJz5p28vU87476hoOkeTvUCK0U=' 
WHERE 
  key_id = 'df614a7962543f044d7a1cbd0a7e7e6e87e3886f5ec2f0982e2942ec6402aae8' 
  AND (
    token = 'xIkjw2Komt+ry2QGNkJz5p28vU87476hoOkeTvUCK0U=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044