UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'mRZRzhfxieikoO+ahH0OgN2igdIt+Byn28EfHsycriA='
WHERE
key_id = 'fff4385570942431e7c0692e1fca62367f3cc2d64fe508a8092e4afab78a8207'
AND (
token = 'mRZRzhfxieikoO+ahH0OgN2igdIt+Byn28EfHsycriA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)