UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '0JL0N8cUgzvg/yN6XRl80EQlFFxzh6nPFaSBeKc9gXU='
WHERE
key_id = '5d217ddfa6fccaad275617e1205665631f84732e72173ae52a3ed0ba228bce50'
AND (
token = '0JL0N8cUgzvg/yN6XRl80EQlFFxzh6nPFaSBeKc9gXU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)