UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'X5gcz5A2ATf6+yui2hI91WC7ih0Zy6ZCufukzSNRD2I='
WHERE
key_id = 'bd66a30be512f1e150018df21fdfbd3d1e1c9e0f6828e01cd5f587afe462772c'
AND (
token = 'X5gcz5A2ATf6+yui2hI91WC7ih0Zy6ZCufukzSNRD2I='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)