UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '8iHnvWFK2ORmQyA3vMGAo9V7oY6yISOGG9fGEPp1CP4='
WHERE
key_id = '2a63a9ef5b89c2cb006507ce7223f580e19ae098b27ee6c0bc31c08445ae174d'
AND (
token = '8iHnvWFK2ORmQyA3vMGAo9V7oY6yISOGG9fGEPp1CP4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)