UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '6Ho29D1qetsOo+kWUTxCNOAFPLIHOHSce+MmUyyYBeM='
WHERE
key_id = 'a1052e93e8e2c60a73ffcc0948147c5a73075ee80650b52dcab3b3292f340af5'
AND (
token = '6Ho29D1qetsOo+kWUTxCNOAFPLIHOHSce+MmUyyYBeM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)