UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'TSyqx4L9R+3e3vrZvJm1FpINZszZLn11PFuaJ8aCcKM=' 
WHERE 
  key_id = '1a2a9b516fc36029a50d57ebb224e5cbdd60a56c0eb9636004fcd64d55eebde8' 
  AND (
    token = 'TSyqx4L9R+3e3vrZvJm1FpINZszZLn11PFuaJ8aCcKM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028