UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '31mLfk4F197NIOA6lVKYzdkBE1hyeYBElUp6zE5sv1o='
WHERE
key_id = 'e50a53bbea164b5a155f471d3d0511d02ca3122c89d06104c030073d33caa40a'
AND (
token = '31mLfk4F197NIOA6lVKYzdkBE1hyeYBElUp6zE5sv1o='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)