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