UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'bM6dcgdicuavhkA2L1ZDwqMELFNIe2qBvmo7Lvkcvxk='
WHERE
key_id = 'b8c9dac8f7d7ba5b87c214494d3c93db2840baf447883716ef0c656ff3a5d860'
AND (
token = 'bM6dcgdicuavhkA2L1ZDwqMELFNIe2qBvmo7Lvkcvxk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)