UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'tAc+dfj6wws0BkWoKVDXp/TKB7/YFQJQogc8H1kxzUY='
WHERE
key_id = 'c2a7948c7cf4b00cdf12b954e0f72ede0ec4c0b4791d60cb173b8ab13f15ff54'
AND (
token = 'tAc+dfj6wws0BkWoKVDXp/TKB7/YFQJQogc8H1kxzUY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)