UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'PsLYEQYD0b5V0Os6eJrQC3or/trYf6KO+J0DIQR6RA4='
WHERE
key_id = 'a7ecc10f0ba223e55d72ad34154740b4dde8fca511e9b108dd353b4f9fd18f4f'
AND (
token = 'PsLYEQYD0b5V0Os6eJrQC3or/trYf6KO+J0DIQR6RA4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)