UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'aJYgNRs4HM7CslbMi/ldke+wv4C4H1+oQCNZSmbJYjM='
WHERE
key_id = '8744b33f1ab4d47c4239164a4712fbdbc707584b35288aa5f5d43c5b36975061'
AND (
token = 'aJYgNRs4HM7CslbMi/ldke+wv4C4H1+oQCNZSmbJYjM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)