UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'YuT+HmUjf8anQ3/UQqNdc6r9WUjITRbg4ndeUeQXFrM='
WHERE
key_id = 'ec6429e683470f1a7aedddf53b00079ec6837c0cb5909539140230116558dac8'
AND (
token = 'YuT+HmUjf8anQ3/UQqNdc6r9WUjITRbg4ndeUeQXFrM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)