UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'dn8jSuk4V7DYNgFgLVT13EWl4WBSWkMRANkn42WSBoA='
WHERE
key_id = 'b373c74b9e7fbf1a71504699e088732005d12036b49cbc6703feb1f770daaa60'
AND (
token = 'dn8jSuk4V7DYNgFgLVT13EWl4WBSWkMRANkn42WSBoA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)