UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '08qOEeA0etsokXCC0y8Caf844DchSqqNeck56HRT4DI='
WHERE
key_id = '9cd847c8f249ae67325f463afb5c9d89a6985fe1d2d428818d52cdb1349e3c1c'
AND (
token = '08qOEeA0etsokXCC0y8Caf844DchSqqNeck56HRT4DI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)