UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'bKJG4jGHHecmuM+1nciw3lHgw+KIDx8Nm70W+HEvkWM='
WHERE
key_id = 'bb486597972a18c4e4c1c933e539440301a3326b13c3346dfbd8a3c08fc80e0b'
AND (
token = 'bKJG4jGHHecmuM+1nciw3lHgw+KIDx8Nm70W+HEvkWM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)