UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'k7wcXFDRpVZr+A352zP4AZ9Pa5HM34VHRtLAImaDzXI='
WHERE
key_id = 'b8a764cfa2b59edf5e6d7098da70d0c02efb8327a067f6a7bfc0351c5140c838'
AND (
token = 'k7wcXFDRpVZr+A352zP4AZ9Pa5HM34VHRtLAImaDzXI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)