UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'b3UZjRhIziMDetx23S3tkKqtv3oHha7OB6gGW44iUMA='
WHERE
key_id = '3f12c628c4d6d18434c627006c974c4a3ab200bb12da256e2c0d4244e92cafe4'
AND (
token = 'b3UZjRhIziMDetx23S3tkKqtv3oHha7OB6gGW44iUMA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)