UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'dihUhkFe0zTGxK0QT8slLfpYO1CnmuzQ9+3lyA1pnII='
WHERE
key_id = 'b9d40ea0e900a69c913e8e83b298f216509b70947774ea0ff2b2c0b7466cde4b'
AND (
token = 'dihUhkFe0zTGxK0QT8slLfpYO1CnmuzQ9+3lyA1pnII='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)