UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'JY3y1fc61qS5//1hF1EYs+/qb5IXxzmfhlMZ0wuFC9Y=' 
WHERE 
  key_id = '8e975520e0dea06f51a4a25d9d7fb4046ecc929b7fc2b2790b1d48bc84a147ad' 
  AND (
    token = 'JY3y1fc61qS5//1hF1EYs+/qb5IXxzmfhlMZ0wuFC9Y=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027