UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'BkH9G+NOQX8cJPKtu9gH1nWdmdjk8CToBk2a9yzxRes='
WHERE
key_id = '785f46cfb1edeccc8816d5eef190a66e859a1d96417a38f13793d787d875c365'
AND (
token = 'BkH9G+NOQX8cJPKtu9gH1nWdmdjk8CToBk2a9yzxRes='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)