UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'WCRNXzcm9NIXOT88HdGXLygME//YUqDWecAaYu34Ypw='
WHERE
key_id = '3cd91c19de8a1bea10cd7b755275ed32f7e2f28a4f028e90350f545b98f61cf4'
AND (
token = 'WCRNXzcm9NIXOT88HdGXLygME//YUqDWecAaYu34Ypw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)