UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'K1+34+RzRdvHwA3obtfD06uFPfF2TSR4T71p5lMbJBg=' 
WHERE 
  key_id = '58b7c17b905fe860de2759620b9a9a16f4b0ce78928bdcf732fefeae48300aa0' 
  AND (
    token = 'K1+34+RzRdvHwA3obtfD06uFPfF2TSR4T71p5lMbJBg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031