UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'L4hCzlgJUdYZOWxgyr4q9OVgami/kUvd6ewH+8IrPcQ='
WHERE
key_id = 'e9ba6945c30b6e348642b31143a54428fc1cf775a83c8d6522bc139223794798'
AND (
token = 'L4hCzlgJUdYZOWxgyr4q9OVgami/kUvd6ewH+8IrPcQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)