UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'tP1p6GP0X69/6oDAJ0Xgo18k8a4rxJQYW8PGjgaILIk='
WHERE
key_id = '40c494bb28083dd510a8ef0ce6f2a2a4e06c8885487d2942a805f09c4fc8dad6'
AND (
token = 'tP1p6GP0X69/6oDAJ0Xgo18k8a4rxJQYW8PGjgaILIk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)