UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'N3zxl8qHIZzB7foutqd3fRSUqFcHGV5ET4Aox17k+EM='
WHERE
key_id = '6c86cade19a168a7684a1106f57780a68dc268679ba0ee92de4d7b83c0c22aa7'
AND (
token = 'N3zxl8qHIZzB7foutqd3fRSUqFcHGV5ET4Aox17k+EM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)