UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'msiu+sDjy3Xxc8mFRVXm7sJSJJnwcy+ZNIcjEVp/g7M='
WHERE
key_id = 'be01f74d7ad54190b50ca3885d7391cc75d1f3e2c8d41b497a9143af2ea371cf'
AND (
token = 'msiu+sDjy3Xxc8mFRVXm7sJSJJnwcy+ZNIcjEVp/g7M='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)