UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'I7ZsAe6rHJC5ZQMEiqQ8+DVhoBR91P9V+jrr87/Jnj0='
WHERE
key_id = 'dbe5436637d2a2d4658ccd819ab2aefab99ece9b041bf3974e19f808db523859'
AND (
token = 'I7ZsAe6rHJC5ZQMEiqQ8+DVhoBR91P9V+jrr87/Jnj0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)