UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'W9jaa4KzV4BBxEoFNF8WiW/M7idFkHz0RrluHQMIl8s='
WHERE
key_id = '03bedadd85c7588a3cc6894f6cdbc18452aa9046ca54829cb4227024a8563cc0'
AND (
token = 'W9jaa4KzV4BBxEoFNF8WiW/M7idFkHz0RrluHQMIl8s='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)