UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Q7kNg1kXJdXmESZxoS0Fd574Wk+OmkSe+oavH9QMKYk='
WHERE
key_id = '050e04223dada4033c808d7d86c1d80ac0196676dff3782ea656026d14c5f52c'
AND (
token = 'Q7kNg1kXJdXmESZxoS0Fd574Wk+OmkSe+oavH9QMKYk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)