UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '8lA+vvscU3Kh7cabRkX37MQRAaUSi6ldc5ta24/VF4I='
WHERE
key_id = 'ccc0ecd85e922c3530255c1ee64d409a02db0317e1772b97a1909c011b466240'
AND (
token = '8lA+vvscU3Kh7cabRkX37MQRAaUSi6ldc5ta24/VF4I='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)