UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'AglHmx3INWuxlJZQojPWaUQbU4cC0z8oGA0OgunEKeE='
WHERE
key_id = 'd450e8f623500930336f0f90bea0b1320b8a93bf582ef331adc6872883e80944'
AND (
token = 'AglHmx3INWuxlJZQojPWaUQbU4cC0z8oGA0OgunEKeE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)