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