UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '2Ir5TH2+WXXE89A+Bal71M5SM6UWaHHitTvdBYxyXg4='
WHERE
key_id = '28ed9914d990e246e24b2b992371a16526df36efddd224b4c393f4340ddb238b'
AND (
token = '2Ir5TH2+WXXE89A+Bal71M5SM6UWaHHitTvdBYxyXg4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)