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